<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE html>

<html>

	<head>

		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

		<title>仪器共享</title>

		<meta name="keywords" content="科研仪器，生命科学仪器，环境检测仪器，实验常用设备，分析仪器">

		<meta name="description" content="中国领先的科研仪器共享平台，让您快速找到各种类型的科学研究仪器。提升闲置仪器利用率，产生更大科研价值。涵盖：生命科学仪器、环境检测仪器、实验常用设备、分析仪器、仪表、物性测试、测量/计量仪器、在线及过程控制仪器。

">
		<!--<link rel="stylesheet" href="new_css/header_footer.css?t=1">-->
		<!--<link rel="stylesheet" href="css/labs.css">-->
		<link rel="stylesheet" href="new_css/publishService.css">

		<link rel="stylesheet" href="css/new_style.css">
		<link rel="stylesheet" href="css/reset.css">
		<link rel="stylesheet" href="css/common.css">
		<script src="new_js/jquery-1.11.3.js"></script>
		<style>
			div#readOnly img {
				width: 24px;
				height: 25px;
			}
			.mainList .content .right .title{
				margin-left: 30px;
			}
			.main-content-mid {
				margin-left: 40px;
			}
			.mainList .content    {
				width: 100%;
				overflow: hidden;
				 height: 100% !important;
			}
			.mainList .content .right{
				height: 830px !important;
			}


			/*小箭头*/

			.sun_item>.sun_item_div1:after, .sun_item>.sun_item_div1:before {
				border: solid transparent;
				content: '';
				height: 0;
				left: 100%;
				position: absolute;
				width: 0;
			}
			.sun_item>.sun_item_div1:before {
				border-width: 12px;
				border-left-color: rgba(196,196,196,1);
				top: 75px;
			}
			.sun_item>.sun_item_div1:after {
				border-width: 10px;
				border-left-color: #fff;
				top: 77px;
			}


			/*goods-comm-stars style*/
			.goods-comm{height:41px;position:relative;z-index:7;}
			.goods-comm-stars{line-height:25px;height:41px;position:absolute;top:0px;left:0;width:400px;}
			.goods-comm-stars .star_l{float:left;display:inline-block;margin-right:5px;display:inline;}
			.goods-comm-stars .star_choose{float:left;display:inline-block;}
			/* rater star */
			.rater-star{position:relative;list-style:none;margin:0;padding:0;background-repeat:repeat-x;background-position:left top;float:left;}
			.rater-star-item, .rater-star-item-current, .rater-star-item-hover{position:absolute;top:0;left:0;background-repeat:repeat-x;}
			.rater-star-item{background-position: -100% -100%;}
			.rater-star-item-hover{background-position:0 -48px;cursor:pointer;}
			.rater-star-item-current{background-position:0 -48px;cursor:pointer;}
			.rater-star-item-current.rater-star-happy{background-position:0 -25px;}
			.rater-star-item-hover.rater-star-happy{background-position:0 -25px;}
			.rater-star-item-current.rater-star-full{background-position:0 -72px;}
			/* popinfo */
			.popinfo{display:none;position:absolute;top:30px;background:url(images/infobox-bg.gif) no-repeat;padding-top:8px;width:192px;margin-left:-14px;}
			.popinfo .info-box{border:1px solid #f00;border-top:0;padding:0 5px;color:#F60;background:#FFF;}
			.popinfo .info-box div{color:#333;}
			.rater-click-tips{font:12px/25px;color:#333;margin-left:10px;background:url(images/infobox-bg-l.gif) no-repeat 0 0;width:151px;height:34px;padding-left:16px;overflow:hidden;}
			.rater-click-tips span{display:block;background:#FFF9DD url(images/infobox-bg-l-r.gif) no-repeat 100% 0;height:34px;line-height:34px;padding-right:5px;}
			.rater-star-item-tips{background:url(images/star-tips.gif) no-repeat 0 0;height:41px;overflow:hidden;}
			.cur.rater-star-item-tips{display:block;}
			.rater-star-result{color:#FF6600;font-weight:bold;padding-left:10px;float:left;}



			/*评论*/
			.commentary{
				width:935px;
				height:402px;
				border: 1px solid #C4C4C4;
			}
			.commentary .buyer-evaluation{
				width: 467px;
				border-right: 1px solid #d2d2d2;




			}
			.commentary .buyer-evaluation .buyer-evaluation-title{
				height: 41px;
				line-height: 41px;
				margin: 8px auto;
				text-align: center;


				/*border-bottom: 1px solid #d2d2d2;*/

			}
			.commentary .buyer-evaluation .buyer-evaluation-title p{
				padding-bottom: 8px;
				border-bottom: 1px solid #d2d2d2;
				color: #1A1A1A;
				font-size:16px;
				/**/
			}

			.buyer-evaluation-content{
				margin: 20px 0 0px 20px;
				height: 300px;
				overflow: hidden;
				text-overflow: ellipsis;
			}



			.buyer-evaluation-content ul li span{
				color: #FF8A00;
			}

			.buyer-evaluation-time{
				text-align: right;
				margin-right: 20px;
			}

			.your-reply{
				border-right: 0px !important;
			}
			.commentary-btn{
				margin-right: 221px;
				margin-top: 30px;
			}

			a.clearfix.fr.commentary-btn {
				width: 151px;
				height: 46px;
				line-height: 46px;
				background-color: #ff8a00;
				text-align: center;
				color: #fff;
				font-size: 16px;
				border-radius: 5px;
			}

		</style>
		<script>
			$(function() {
				$('#front_header .header_wrap .right').hover(function() {
					$('#front_header .header_wrap .right .main .icon img').attr('src', 'images/icon2.png');
					$('#front_header .header_wrap .right .out').show();
				}, function() {
					$('#front_header .header_wrap .right .main .icon img').attr('src', 'images/icon1.png');
					$('#front_header .header_wrap .right .out').hide();
				});
				$('#sorts').on('mouseover', 'li', function() {
					$(this).find('span img').attr('src', 'images/icon4.png');
				});
				$('#sorts').on('mouseout', 'li', function() {
					$(this).find('span img').attr('src', 'images/icon5.png');
				});

				$('.mainList .content .left li').click(function() {
					$(this).addClass('selected').siblings().removeClass('selected');
				});
			});
		</script>

	</head>

	<body style="background:#fff;">
	<!--header-->
	<%@include file="/header4.jsp"%>

		<div class="mainList">
			<div class="bNav">您的位置：实验订单管理><span>评价回复</span></div>
			<div class="content">
				
				<div class="right">
					<div class="title"><span>评价回复</span></div>
					<div class="main-content-mid clearfix">
						<ul  class="clearfix">
							<li style="margin: 20px auto " >
								<label>使用时间：</label>
								<input type="text" name="" id="" value="" placeholder="30min"/>
							</li>
							<li class="sun_item clearfix">
								<div class="sun_item_div1">服务信息</div>
								<div class="sun_item_div2">
									<div class="sun_item_img">
										<img id="src" src="images/productDetailPic.png" />
									</div>
									<div class="item_box">
										<br />
										<p id="name">高内涵筛选系统</p>
										<br />

										<p id="model">opertter</p>
										<br />


										<div class="goods-comm">
											<div class="goods-comm-stars">
												<span class="star_l">仪器综合评分：</span>
												<div id="readOnly"></div><p id="scoreFenshu"></p>
												<!--<div id="rate-comm-1" class="rate-comm"></div>-->
											</div>
										</div>
									</div>
								</div>
							</li >
						</ul>
						<!--评论-->
						<div class="commentary clearfix">
							<div class="buyer-evaluation fl">

								<div class="buyer-evaluation-title">
									<p>买家评价</p>
								</div>

								<div class="buyer-evaluation-content">
									<ul>
										<li>
											<li style="color: #ccc">
												<textarea id="testLeft" style="border:none; border:1px solid #fff;"disabled="disabled" rows="13" cols="58" placeholder="对方还没有评论"></textarea>
				
											</li>
										</li>
										<!--<li>仪器状态：<span>损坏</span></li>-->
									</ul>
								</div>

								<div class="buyer-evaluation-time">
									<!--<time>2018-8-14 18:31:21</time>-->
								</div>

								<div class="commentary-content">

								</div>
							</div>
							<div class="buyer-evaluation fl your-reply">

								<div class="buyer-evaluation-title">
									<p style="color: #FF8A00">您的回复</p>
								</div>

								<div class="buyer-evaluation-content">
									<ul>
										<li>
											<li style="color: #ccc">
												<textarea id="testRight" style="border:none; border:1px solid #fff;" rows="13" cols="58" placeholder="请您输入文字进行评论"></textarea>
											</li>
										</li>
									</ul>
								</div>
								<div class="buyer-evaluation-time">
									<!-- <time>2018-8-14 18:31:21</time>  -->
								</div>

								<div class="commentary-content">

								</div>
							</div>
						</div>
						<a class="clearfix fr commentary-btn" id="addComment" onclick="addComment()">评价</a>
					</div>

				</div>


			</div>

		</div>
	<!--footer-->
	<%@include file="/footer.jsp"%>
	<script src="js/jquery-1.11.3.js"></script>
	<script src="js/common.js"></script>
	<script src="js/jquery.raty.js"></script>
	<script src="js/labs.js"></script>
	<script>
		$(document).ready(function(){
			infoDetails();
			commentSelect();
			Date.prototype.Format = 
				function(fmt){
				var o = {
					"M+": this.getMonth() + 1, //月份 
	       			"d+": this.getDate(), //日 
	        		"h+": this.getHours(), //小时 
	        		"m+": this.getMinutes(), //分 
	        		"s+": this.getSeconds(), //秒 
	        		"q+": Math.floor((this.getMonth() + 3) / 3), //季度 
	        		"S": this.getMilliseconds() //毫秒 
				};
				if(/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
				for(var k in o)
				if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
	    		return fmt;
			}
		});
		
		function infoDetails(){
			$.ajax({
				url: Server + "/app/exp/orderDetails",
				//url:"http://localhost/app/exp/orderDetails",
				data:{
					"orderId":${param.orderId},
				},
				type:"POST",
				dataType:"json",
				success : function(data){
					var serviceName = "";
					var imagePath = "";
					var avgScore = 0;
					var getTime = "";
					if(data.imagePath != null){
						imagePath = data.imagePath;
					}
					if(data.serviceName != null){
						serviceName = data.serviceName;
					}
					if(data.getTime != null){
						getTime = data.getTime;
					}
					if(data.comment[0].avgScore != null){
						avgScore = data.comment[0].avgScore;
					}
					$('#name').text(serviceName);
					$('#src').attr("src",imagePath);
					$('#model').text("服务结果获取时间："+ new Date(getTime).Format("yyyy-MM-dd"));
					$.fn.raty.defaults.path = 'images';
					$('#readOnly').raty({ readOnly:true, score:avgScore});
				}
			});
		}
		
		function commentSelect(){
			$.ajax({
				url:Server + "/app/exp/commentSelect",
				//url:"http://localhost/app/exp/commentSelect",
				data:{
					orderId : ${param.orderId},
				},
				type:"POST",
				dataType:"json",
				success : function(data){
					var type = 0;
					var testLeft = "";
					var testRight = "";
					for(var i = 0;i < data.length;i++){
						var param = data[i].comment;
						for(var j = 0;j < param.length;j++){
							type = param[j].userType;
							if(type == 1){
								testLeft = param[j].content;
							}else if(type == 2){
								testRight = param[j].content;
							}
						}
					}
					$('#testLeft').val(testLeft);
					$('#testRight').val(testRight);
					if(testRight.length != 0){//万一仪器人员已评价不可进行编译操作
						$('#testRight').attr("disabled","disabled");
						$('#addComment').hide();
					}
				}
			});
		}
		
		function addComment(){
			var uId = $('#useridoflogin').val();
			//var uId = '4d272484d5844be693c05443c4edd71e';
			var content = $('#testRight').val();
			var textLeft = $('#testLeft').val();
			var userType = 2;
			var rate = 0;
			if(content == ''){
				alert("评价不能为空！")
				return;
			}
			if(textLeft == ''){
				rate = 2;
			}else if(textLeft != ''){
				rate = 3;
			}
			$.ajax({
				url:Server + "/app/exp/addComment",
				//url:"http://localhost/app/exp/addComment",
				data:{
					uId : uId,
					soId : ${param.orderId},
					content : content,
					userType : userType,
					rate : rate,
				},
				type:"POST",
				success : function(data){
					if(data == 1){
						alert("评论成功")
						$(location).attr("href","book_admin26_1");
					}else if(data == 0){
						alert("评论失败")
					}
				},
				error : function(data){
					alert("评论异常")
				}
			});
		}

	</script>
	<script>
        /* $.fn.raty.defaults.path = 'images';
        $('#readOnly').raty({ readOnly: true, score: 4.5}); */

        $(function() {
            $('#default').raty();

            $('#score').raty({ score: 3 });

            $('#score-callback').raty({
                score: function() {
                    return $(this).attr('data-score');
                }
            });

            $('#scoreName').raty({ scoreName: 'entity[score]' });

            $('#number').raty({ number: 10 });

            $('#number-callback').raty({
                number: function() {
                    return $(this).attr('data-number');
                }
            });

            $('#numberMax').raty({
                numberMax : 5,
                number    : 100
            });

            $('#starHalf').raty({
                half     : true,
                path     : null,
                starHalf : 'images/star-half-mono.png',
                starOff  : 'images/star-off.png',
                starOn   : 'images/stars-all.png'
            });


            $('#size').raty({
                path      : 'images',
                cancel    : true,
                cancelOff : 'cancel-off.png',
                cancelOn  : 'cancel-on.png',
                half      : true,
                starHalf  : 'star-half.png',
                starOff   : 'star-off.png',
                starOn    : 'stars-all.png'
            });

            $('#target-div').raty({
                cancel : true,
                target : '#target-div-hint'
            });

            $('#target-text').raty({
                cancel : true,
                target : '#target-text-hint'
            });

            $('#target-textarea').raty({
                cancel : true,
                target : '#target-textarea-hint'
            });

            $('#target-select').raty({
                cancel : true,
                target : '#target-select-hint'
            });

            $('#targetType').raty({
                cancel     : true,
                target     : '#targetType-hint',
                targetType : 'score'
            });

            $('#targetKeep').raty({
                cancel     : true,
                target     : '#targetKeep-hint',
                targetKeep : true
            });

            $('#targetText').raty({
                target     : '#targetText-hint',
                targetText : '--'
            });

            $('#targetFormat').raty({
                target       : '#targetFormat-hint',
                targetFormat : 'Rating: {score}'
            });

            $('#targetScore').raty({
                targetScore: '#target-score'
            });


            $('#precision').raty({
                cancel     : true,
                cancelOff  : 'cancel-off.png',
                cancelOn   : 'cancel-on.png',
                path       : 'images',
                starHalf   : 'star-half.png',
                starOff    : 'star-off.png',
                starOn     : 'stars-all.png',
                target     : '#precision-hint',
                targetKeep : true,

                precision  : true
            });


            $('#functions').raty({
                cancel     : true,
                cancelOff  : 'cancel-off.png',
                cancelOn   : 'cancel-on.png',
                path       : 'images',
                precision  : true,
                starHalf   : 'star-half.png',
                starOff    : 'star-off.png',
                starOn     : 'stars-all.png',
                target     : '#functions-hint',
                targetKeep : true,
                click: function(score, evt) {
                    alert('ID: ' + this.id + "\nscore: " + score + "\nevent: " + evt.type);
                },
                hints: [
                    ['bad 1'      , 'bad 2'      , 'bad 3'      , 'bad 4'      , 'bad 5'      , 'bad 6'      , 'bad 7'      , 'bad 8'      , 'bad 9'      , 'bad'      ],
                    ['poor 1'     , 'poor 2'     , 'poor 3'     , 'poor 4'     , 'poor 5'     , 'poor 6'     , 'poor 7'     , 'poor 8'     , 'poor 9'     , 'poor'     ],
                    ['regular 1'  , 'regular 2'  , 'regular 3'  , 'regular 4'  , 'regular 5'  , 'regular 6'  , 'regular 7'  , 'regular 8'  , 'regular 9'  , 'regular'  ],
                    ['good 1'     , 'good 2'     , 'good 3'     , 'good 4'     , 'good 5'     , 'good 6'     , 'good 7'     , 'good 8'     , 'good 9'     , 'good'     ],
                    ['gorgeous 1' , 'gorgeous 2' , 'gorgeous 3' , 'gorgeous 4' , 'gorgeous 5' , 'gorgeous 6' , 'gorgeous 7' , 'gorgeous 8' , 'gorgeous 9' , 'gorgeous' ]
                ]
            });

            $('#score-function-run').on('click', function() {
                $('#functions').raty('score', $('#' + this.id.replace('-run', '')).val());
            });

            $('#click-function-run').on('click', function() {
                $('#functions').raty('click', $('#' + this.id.replace('-run', '')).val());
            });

            $('#readOnly-function-run').on('click', function() {
                var isReadOnly = $('#' + this.id.replace('-run', '')).val() === 'true';

                $('#functions').raty('readOnly', isReadOnly);
            });

            $('#cancel-function-run').on('click', function() {
                var isTrigger = $('#' + this.id.replace('-run', '')).val() === 'true';

                $('#functions').raty('cancel', isTrigger);
            });

            $('#reload-function-run').on('click', function() {
                $('#functions').raty('reload');
            });

            $('#get-score-function-run').on('click', function() {
                alert('score: ' + $('#functions').raty('score'));
            });

            $('#set-score-function-run').on('click', function() {
                $('#functions').raty('score', $('#' + this.id.replace('-run', '')).val());
            });

            $('#set-function-run').on('click', function() {
                var options = $('#' + this.id.replace('-run', '').val()),
                    command = "$('#functions').raty('set', " + options + ");";

                eval(command);
            });

            $('#destroy-function-run').on('click', function() {
                $('#functions').raty('destroy');
            });

            $('#move-function-run').on('click', function() {
                $('#functions').raty('move', $('#' + this.id.replace('-run', '')).val());
            });
        });
	</script>
	<style>
	.mainList .content .right {
	width:1157px;
/* 	float:right; */
	height:100%;
	min-height: 1000px;
	padding:0 20px;
	border:1px solid #d3d3d3;
}
	</style>
</body>

</html>